package intranet.models;
import java.sql.*;
public class FileCategoryModel {
	Connection DBConnection=null;
	public FileCategoryModel(){
		DatabaseModel DBModel=new DatabaseModel();
		DBConnection=DBModel.GetConnection();
	}
		/* SELECT FILE CATEGORY BY ID */
	public ResultSet SelectFileCategory(int category_id){
		ResultSet result=null;
		String Conditional_String=(category_id!=0)?" WHERE CATEGORY_ID="+category_id:"";
		try{
			Statement ConStatement=DBConnection.createStatement();
			String Sql="SELECT CATEGORY_ID,CATEGORY_NAME FROM FILE_CATEGORIES "+Conditional_String+" ORDER BY CATEGORY_NAME ASC";
			result=ConStatement.executeQuery(Sql);
		}catch(Exception e){
			e.getLocalizedMessage();
		}
		return result;
	}	
}
